#! /usr/bin/env python
# -*- coding: iso-8859-1 -*-
# vi:ts=4:et
# $Id: basicfirst.py,v 1.5 2005/02/11 11:09:11 mfx Exp $
import os
import sys
'''
import urllib
import json
import hmac
import base64
import hashlib

api='http://10.40.0.201:8080/client/api'
secret='tjEx1gnv1_AFLEA_VxGDyrQY37llrj5SGkpejOzvsJmmUBCvMuBXbxAOywNti-5HXwwl4MI48eeIH8KnOT3cBg'
args={'serviceofferingid':'15',
      'templateid':'202',
      'zoneid':'1',
      'name':'api-ttt',
      'networkids':'204',
      'ipaddress':'192.168.128.12'
      }
args['apikey']='pI-MUZfbjihRSLHhC_ChcaFixKzKoy1S7U0WawbnUBPac_6rVqOFf3jZXyzq9sLQv0am91j1ZLaeMYxxGf5ZAQ'
args['command']='deployVirtualMachine'
args['response']='json'
params=[]
keys = sorted(args.keys())
for k in keys:
    params.append(k + '=' + urllib.quote_plus(args[k]).replace("+", "%20"))
    
query = '&'.join(params)
print query 
signature = base64.b64encode(hmac.new(secret, 
                                      msg=query.lower(), 
                                      digestmod=hashlib.sha1
                                      ).digest())
    
query += '&signature=' + urllib.quote_plus(signature)
apiurl= api + '?' + query
print apiurl
response = urllib.urlopen(apiurl)
decoded = json.loads(response.read())
print decoded
'''
global file
file=''
f2='F:\code\cs-bs\cs\db.ini'
f1='/home/cs-bs/cs/db.ini'
for i in (f1,f2):
    if os.path.exists(i):
        file=i
        print file
        
if file == '':
    print 'not find the file'